package com.zycfc.zsf.boot.util.collection;

import java.util.concurrent.*;
import java.util.*;

public abstract class QueueUtils
{
    public static <E> ArrayDeque<E> newArrayDeque(final int initSize) {
        return new ArrayDeque<E>(initSize);
    }
    
    public static <E> LinkedList<E> newLinkedDeque() {
        return new LinkedList<E>();
    }
    
    public static <E> ConcurrentLinkedQueue<E> newConcurrentNonBlockingQueue() {
        return new ConcurrentLinkedQueue<E>();
    }
    
    public static <E> Deque<E> newConcurrentNonBlockingDeque() {
        return new ConcurrentLinkedDeque<E>();
    }
    
    public static <E> LinkedBlockingQueue<E> newBlockingUnlimitQueue() {
        return new LinkedBlockingQueue<E>();
    }
    
    public static <E> LinkedBlockingDeque<E> newBlockingUnlimitDeque() {
        return new LinkedBlockingDeque<E>();
    }
    
    public static <E> ArrayBlockingQueue<E> newArrayBlockingQueue(final int capacity) {
        return new ArrayBlockingQueue<E>(capacity);
    }
    
    public static <E> LinkedBlockingQueue<E> newLinkedBlockingQeque(final int capacity) {
        return new LinkedBlockingQueue<E>(capacity);
    }
    
    public static <E> LinkedBlockingDeque<E> newBlockingDeque(final int capacity) {
        return new LinkedBlockingDeque<E>(capacity);
    }
    
    public static <E> Queue<E> newStack(final int initSize) {
        return Collections.asLifoQueue(new ArrayDeque<E>(initSize));
    }
    
    public static <E> Queue<E> newConcurrentStack() {
        return Collections.asLifoQueue(newConcurrentNonBlockingDeque());
    }
}
